{% extends "base.html" %}

{% block title %}编辑图书 - 图书管理系统{% endblock %}

{% block content %}
    <h1>编辑图书</h1>
    
    {% if course %}
        <form method="post" action="{{ url_for('edit_course_html', course_id=course.id) }}">
            <div class="form-group">
                <label for="name">图书名称 *</label>
                <input type="text" id="name" name="name" value="{{ course.name }}" required minlength="1" maxlength="100">
            </div>
            <div class="form-group">
                <label for="credit">学分 *</label>
                <input type="number" id="credit" name="credit" value="{{ course.credit }}" step="0.5" min="0.5" max="10.0" required>
            </div>
            <div class="actions">
                <button type="submit" class="btn btn-primary">更新图书</button>
                <a href="{{ url_for('get_courses_html') }}" class="btn btn-secondary">取消</a>
            </div>
        </form>
    {% else %}
        <div class="message error">未找到指定图书。</div>
        <a href="{{ url_for('get_courses_html') }}" class="btn btn-secondary">返回列表</a>
    {% endif %}
{% endblock %}